var ChildFrameLoaded = 0;
var ChildFrameCount = null;
var IsLoading = true;

function DisabledPage()
{
	var bgObj = document.all["__bgDiv"];
	if(bgObj)
		return;
	bgObj=document.createElement("div");
	bgObj.setAttribute('id','__bgDiv');
	bgObj.style.position="absolute";
	bgObj.style.top="0";
	bgObj.style.background="#f0f0f0 url(/_imgs/progress.gif) no-repeat center center";
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75)";
	bgObj.style.opacity="0.6";
	bgObj.style.left="0";
	bgObj.style.width="100%";
	bgObj.style.height="100%";
	bgObj.style.zIndex = "10000";
	bgObj.align="center";
	document.body.appendChild(bgObj);
}

function EnabledPage()
{
	var bgObj = document.all["__bgDiv"];
	if(bgObj)
		document.body.removeChild(bgObj);
}

function Loaded()
{
	if(IsLoading)
	{
		ChildFrameLoaded++;
		if(ChildFrameCount != null)
		{
			if(ChildFrameLoaded == ChildFrameCount)
			{
				EnabledPage();
				if(parent!=window)
				{
					try{parent.Loaded();}catch(ex){};
				}
			}
		}
	}
}

function __Loaded(IsNoExistsFrame)
{
	if(IsNoExistsFrame)
	{
		if(parent&&parent!=window)
		{
			try{parent.Loaded();}catch(ex){};
		}
	}
	else
	{
		setTimeout("__UpdatePage()",0);
	}
}

function __UpdatePage()
{
	var i;
	DisabledPage();
	ChildFrameCount=window.frames.length;
	for(i=window.frames.length-1;i>=0;i--)
	{
		if(window.frames[i].location.host=="")
			ChildFrameCount--;
	}
	if(ChildFrameLoaded == ChildFrameCount)
	{
		EnabledPage();
		if(parent!=window)
		{
			try{parent.Loaded();}catch(ex){};
		}
	}
}